package pers.hl.module_main.search

import pers.hl.common.base.BaseViewModel
import pers.hl.common.base.SingleLiveEvent
import pers.hl.lib_global.model.bean.Book

class SearchViewModel: BaseViewModel<SearchModel>() {

    private val searchData = SingleLiveEvent<List<Book>>()

    fun search(content: String, pageNum: Int): SingleLiveEvent<List<Book>> {
        launchOnIO {
            val result = mModel.search(content, pageNum)
            val books = result.data
            launchOnUI {
                searchData.value = books
            }

        }
        return searchData
    }

}